/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.envconfig.util;

import java.util.Map;
import java.util.Set;

/**
 *
 * @author Pete
 */
public class SimpleConfiguration extends AbstractConfiguration {
    private Map<String, String> tuples;

    public SimpleConfiguration(Map<String, String> tuples) {
        if (tuples == null) {
            throw new IllegalArgumentException("tuples must not be null");
        }

        this.tuples = tuples;
    }

    @Override
    public Set<String> keys() {
        return tuples.keySet();
    }

    @Override
    public String get(String key, String def) {
        String value = tuples.get(key);

        return value != null ? value : def;
    }

}
